>> if you have an IBM-PC, practice using the cursor keypad.
ERRORS
------
Sometimes you may do something which EMACS doesn't allow. If it is
something simple, such as typing a control key sequence which is not
associated with any command, EMACS will just beep at you. Otherwise,
EMACS will also display an informative error message at the bottom of
the screen.
Some versions of EMACS do not have all the features described in this
tutorial implemented yet. If you come across such an unimplemented
feature, you may get an error message when you try to use it. Just
type a space and proceed on to the next section of the tutorial.
INSERTING AND DELETING
----------------------
If you want to type text, just do it. Characters which you can see, such
as A, 7, *, etc. are taken by EMACS as text and are immediately inserted.
Type <Return> (the carriage-return key) to insert a line separator.
You can delete the last character you typed by typing either <Delete> or ^H.
On some keyboards, there is a dedicated key for creating a ^H. If so, it is
usually labeled as either "Backspace" or "<--". <Delete> is a key on the
keyboard, which may be labeled "Rubout" instead of "Delete" on some terminals.
More generally, <Delete> deletes the character immediately before the current
cursor position.
>> Do this now, type a few characters and then delete them by typing
<Delete> a few times. Don't worry about this file being changed;
you won't affect the master tutorial. This is just a copy of it.
>> Now start typing text until you reach the right margin, and keep
typing. When a line of text gets too big for one line on the
screen, the line of text is "continued" off the edge of the screen
The dollar sign at the right margin indicates a line which has
been continued. EMACS scrolls the line over so you can see what you
are editing. The '$' at the left or right edge of the screen indicates
that the current line extends off in that direction.
>> The following line actually goes off the edge. Trying typing enough ^F's
so that you move off the right hand end of this line. This is a long line of text. Note the "$"s at each edge. Keep typing ^F's and watch where EMACS decides to scroll the line. Now, type ^B's until EMACS decides to scroll the line again.
This is one of those gizmos which is easier to understand by playing with it
than by reading about it.
>> Use ^D's or <Delete>s to delete the text until the text line fits on
one screen line again. The continuation "$" will go away.
>> Move the cursor to the beginning of a line and type <Delete>. This
deletes the line separator before the line and merges the line onto
the previous line. The resulting line may be too long to fit, in
which case it has a continuation indication.
>> Type <Return> to insert the separator again.
Internally, EMACS will allow you to have lines of nearly any length, limited
only by the amount of memory available. Externally, however, EMACS can only
read or write lines, to or from a file, which are less than or equal to 255
characters.
Remember that most EMACS commands can be given a repeat count; Note
that this includes characters which insert themselves.
>> Try that now -- type META 8 * and see what happens.
If you want to create a blank line in between two lines, move to the
second of the two lines and type ^O.
>> Try moving to a line and typing ^O now.
You've now learned the most basic way of typing something in
EMACS and correcting errors. You can delete by words or lines
as well. Here is a summary of the delete operations:
<Delete> delete the character just before the cursor
^H delete the character just before the cursor
^D delete the next character after the cursor
ESC-<Delete> kill the word immediately before the cursor
ESC-^H kill the word immediately before the cursor
ESC-D kill the next word after the cursor
^K kill from the cursor position to end of line
Notice that <Delete> and ^D vs ESC-<Delete> and ESC-D extend the parallel
started by ^F and ESC-F (well, <Delete> isn't really a control
character, but let's not worry about that).
Now suppose you kill something, and then you decide that you want to get
it back? Well, whenever you kill something bigger than a character, EMACS
saves it for you. To yank it back, use ^Y. Note that you don't have to
be in the same place to do ^Y; This is a good way to move text around.
Also note that the difference between "Killing" and "Deleting" something
is that "Killed" things can be yanked back, and "Deleted" things cannot.
Generally, the commands that can destroy a lot of text save it, while the
ones that attack only one character, or nothing but blank lines and spaces,
do not save.
For instance, type ^N a couple times to postion the cursor
at some line on this screen.
>> Do this now, move the cursor and kill that line with ^K.
Note that a single ^K kills the contents of the line, and a second
^K kills the line itself, and make all the other lines move up. If
you give ^K a repeat count, it kills that many lines AND their contents.
The text that has just disappeared is saved so that you can
retrieve it. To retrieve the last killed text and put it where
the cursor currently is, type ^Y.
>> Try it; type ^Y to yank the text back.
Think of ^Y as if you were yanking something back that someone took away
from you. Notice that if you do several ^K's in a row the text that is
killed is all saved together so that one ^Y will yank all of the lines.
>> Do this now, type ^K several times.
Now to retrieve that killed text:
>> Type ^Y. Then move the cursor down a few lines and type ^Y
again. You now see how to copy some text.
What do you do if you have some text you want to yank back, and then
you kill something else? ^Y would yank the more recent kill.
>> Kill a line, move around, kill another line.
Then do ^Y to get back the second killed line.
FILES
-----
In order to make the text you edit permanent, you must put it in a file.
Otherwise, it will go away when you leave EMACS. While you are editing a
file in EMACS, your changes are actually being made to a private
"scratch" copy of the file. However, the changes still don't become
permanent until you "save" the file. This is so you can have control to
avoid leaving a half-changed file around when you don't want to.
If you look near the botton of the screen you will see a line that